<div bsModal #createOrEditModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="createOrEditModal"
  aria-hidden="true" [config]="{backdrop: 'static'}">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <form *ngIf="active" #editForm="ngForm" novalidate (ngSubmit)="save()" autocomplete="off">
        <div class="modal-header">
          <h4 class="modal-title">
            <span *ngIf="location.id">编辑位置</span>
            <span *ngIf="!location.id">创建新的位置</span>
          </h4>
          <button type="button" class="close" (click)="close()" [attr.aria-label]="l('Close')">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body">

          <div class="form-group">
            <label for="name">名称 *</label>
            <input id="name" #nameInput="ngModel" type="text" name="name" class="form-control"
              [(ngModel)]="location.name" required>
            <validation-messages [formCtrl]="nameInput"></validation-messages>
          </div>

          <div class="form-group">
            <label for="code">编码</label>
            <input id="code" #codeInput="ngModel" type="text" name="code" class="form-control"
              [(ngModel)]="location.code" required>
            <validation-messages [formCtrl]="codeInput"></validation-messages>
          </div>

          <div class="form-group">
            <label for="description">描述</label>
            <textarea class="form-control" type="text" name="description" [(ngModel)]="location.description" rows="3"></textarea>
          </div>
        </div>
        <div class="modal-footer">
          <button [disabled]="saving" type="button" class="btn btn-default" (click)="close()">{{l("Cancel")}}</button>
          <button type="submit" class="btn btn-primary" [disabled]="!editForm.form.valid" [buttonBusy]="saving"
            [busyText]="l('SavingWithThreeDot')"><i class="fa fa-save"></i> <span>{{l("Save")}}</span></button>
        </div>
      </form>
    </div>
  </div>
</div>
